


*******************************************************************************
*																			  
* Explaining Variation in Political Leadership by Marginalized Groups	 
*																			  
* Replication file, prepared July 2023									  
* email karin@vt.edu with any questions							  
*																			  
*******************************************************************************

* Install packages and set scheme make figures
ssc install outreg2
ssc install psmatch2
ssc install sensatt 



* Set working directory to folder

 ** -- Your working directory here! -- **
*cd "G:\My Drive\Working Papers\Contraband Camps\Do Files\JOP Replication Files"



use analysis_data, clear
* SET SEED
* if seed isn't set for each run, you will get different bootstrap standard errors 
set seed 1234

****************
* Table 1
****************

* Dependent Variables 
eststo campsd: estpost summarize ///
     black_office if camps == 1 & sample==1
eststo nocampsd:  estpost summarize ///
    black_office   if camps == 0 & sample==1
eststo diffd:  estpost ttest ///
    black_office  if sample==1 , by(camps) unequal

esttab campsd  nocampsd diffd using table1.tex, ///
cells("mean(pattern(1 1 0) fmt(2)) sd(pattern(1 1 0)) b(star pattern(0 0 1) fmt(2)) t(pattern(0 0 1) par fmt(2))") ///
label tex replace


********
* Table 2
********
* Mahalanobis matching
set seed 1234
bootstrap r(att) : psmatch2 camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths rail1860 water1860 battle_count i.stateid, out(black_office) mahalanobis( battle_count landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths  rail1860 water1860  i.stateid) 
outreg2 using table2.tex,  label replace
* Full models, no propensity score matching 
set seed 1234
xtreg  black_office camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths battle_count,  i(stateid) fe vce(boot)
outreg2 using table2.tex,  label

* drop Ohio and Missisppi Rivers
set seed 1234
bootstrap r(att) : psmatch2 camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths rail1860 water1860 battle_count i.stateid  if river_msoh!=1, out(black_office) mahalanobis( battle_count landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths  rail1860 water1860  i.stateid) 
outreg2 using table2.tex,  label

set seed 1234
xtreg black_office camps  neighbor landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths battle_count , i(stateid) fe vce(boot)
outreg2 using table2.tex,  label


set seed 1234
bootstrap r(att) : psmatch2 camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths rail1860 water1860 battle_count i.stateid if troop_yes==1 , out(black_office) mahalanobis( battle_count landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths  rail1860 water1860  i.stateid)
outreg2 using table2.tex,  label

set seed 1234
xtreg black_office camps fb_yes troop_yes landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths battle_count, i(stateid) fe vce(boot)
outreg2 using table2.tex,  label




****************
* Appendix 
****************

* Summary statistics 

* Table 1.1 Independent Variables
eststo camps:  estpost summarize ///
    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860  conf_deaths union_deaths battle_count  if camps == 1 & sample==1
eststo nocamps:  estpost summarize ///
    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860  conf_deaths union_deaths battle_count if camps == 0 & sample==1
eststo diff: estpost ttest ///
    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860  conf_deaths union_deaths battle_count if sample==1 , by(camps) unequal

esttab   camps nocamps  diff using table1_1.tex, ///
cells("mean(pattern(1 1 0) fmt(2)) sd(pattern(1 1 0)) b(star pattern(0 0 1) fmt(2)) t(pattern(0 0 1) par fmt(2))") ///
label tex replace


***************************
* Table 1.2 
************************
* Table 1.2 Independent Variables
eststo camps2:  estpost summarize ///
  fb_yes troop_yes   church_new church_new_dum maj_black if camps == 1 & sample==1
eststo nocamps2: estpost summarize ///
     fb_yes troop_yes   church_new church_new_dum maj_black if camps == 0 & sample==1
eststo diff2: estpost ttest ///
     fb_yes troop_yes  church_new church_new_dum maj_black if sample==1 , by(camps) unequal

esttab   camps2 nocamps2  diff2 using table1_2.tex, ///
cells("mean(pattern(1 1 0) fmt(2)) sd(pattern(1 1 0)) b(star pattern(0 0 1) fmt(2)) t(pattern(0 0 1) par fmt(2))") ///
label tex replace



****************************************
* Table 1.2.1- Only Local Officeholders 
****************************************
set seed 1234
bootstrap r(att) : psmatch2 camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths rail1860 water1860 battle_count i.stateid , out(local_office) mahalanobis( battle_count landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths  rail1860 water1860  i.stateid) 
outreg2 using table_121.tex,  label replace 
set seed 1234
xtreg local_office camps    landineq1860_up  totpop1860_up fvalpc1860_up  fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths battle_count,  i(stateid) fe vce(boot)
outreg2 using table_121.tex,  label
set seed 1234
xtreg local_office camps neighbor landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths battle_count, i(stateid) fe vce(boot)
outreg2 using table_121.tex,  label



******************************************************
* Figure 1.2 Standardized differences in matched data 
******************************************************


set seed 1234
psmatch2 camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths  battle_count i.stateid , out(black_office) caliper(.5)
pstest landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths  battle_count , graph both label title(Propensity Score Matching) scheme(s1mono)  saving(ps_match, replace)

set seed 1234
bootstrap r(att) :psmatch2 camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths  battle_count i.stateid, out(black_office) mahalanobis(   battle_count landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths  rail1860 water1860  i.stateid)
pstest landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths battle_count, graph both label title(Matching with Mahalanobis Distance) scheme(s1mono)  saving(mah_match, replace)



*************************************************
* Figure 1.4 Counties with Contraband Camps
*************************************************
set seed 1234
eststo c1: bootstrap r(att) : psmatch2 camps   landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths  battle_count i.stateid, out(black_office) mahalanobis(  battle_count landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit conf_deaths union_deaths  rail1860 water1860  i.stateid)
coefplot  c1 , scheme(s1mono) coeflabels(_bs_1="Camps") vertical  ytitle("Black Elected Official") yline(0)  mlabel format(%9.2f) levels(95 90 )  title("Matching")
graph save graph_c1.gph, replace


set seed 1234
eststo c2: xtreg  black_office   camps   landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths battle_count,  i(stateid) fe vce(boot)
coefplot  c2 , scheme(s1mono) coeflabels(_bs_1="Camps") vertical  ytitle("Black Elected Official") yline(0)  mlabel format(%9.2f) levels(95 90 ) keep(camps) title("OLS Regression")
graph save graph_c2.gph, replace


graph combine graph_c1.gph graph_c2.gph , rows(1) ycommon xcommon  scheme(s1mono)
								graph save graph_officials_main.gph, replace
				graph export figure_14.pdf, as(pdf) replace
				




**************************************
* Table 1.2.2 Sensitivity Analysis 
**************************************
* psmatch2 with nearest neighbor

xtreg  black_office camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths battle_count,  i(stateid) fe vce(boot)
gen sample_all=e(sample)

*keep if sample_all==1


tab stateid, gen(stateid_)
* set seed 1234
* prefer psmatch2 with i.stateid because it is being treated as a factor variable. But coefficients the same in the next. standard errors are different, but same conclusion is drawn. 
* bootstrap r(att) : psmatch2 camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths rail1860 water1860 battle_count i.stateid, out(black_office)  n(1) 
set seed 1234
bootstrap r(att) : psmatch2 camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths rail1860 water1860 battle_count stateid_2 stateid_4 stateid_5 stateid_6 stateid_7 stateid_8 stateid_9  stateid_10 stateid_12 stateid_13 stateid_14 stateid_15 stateid_16 stateid_17 stateid_18 , out(black_office)  n(1) 
outreg2 using table_122.tex,  replace label 

* this is to show the consistency with nearest neighbor match
* attnd black_office camps landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths rail1860 water1860 battle_count ///
*      stateid_2 stateid_4 stateid_5 stateid_6 stateid_7 stateid_8 stateid_9  stateid_10 stateid_12 stateid_13 stateid_14 stateid_15 stateid_16 stateid_17 stateid_18 if sample_all==1, detail

	  
* note: the sensatt command first reports results with no simulated confounder; results the same as using the attnd to obtain nearest neighbor match and very similar to psmatch2	  
* we report the ATT from the second table with the sumulated confounder; table created in latex
set seed 1234
* bounding with waterway access
sensatt black_office camps landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths rail1860 water1860 battle_count ///
      stateid_2 stateid_4 stateid_5 stateid_6 stateid_7 stateid_8 stateid_9  stateid_10 stateid_12 stateid_13 stateid_14 stateid_15 stateid_16 stateid_17 stateid_18 if sample==1 , p(water1860) reps (100) alg(attnd) se(bse)

* we report the ATT from the second table with the sumulated confounder; table created in latex	  
set seed 1234	  
* bounding with rail access
sensatt black_office camps landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths rail1860 water1860 battle_count ///
      stateid_2 stateid_4 stateid_5 stateid_6 stateid_7 stateid_8 stateid_9  stateid_10 stateid_12 stateid_13 stateid_14 stateid_15 stateid_16 stateid_17 stateid_18 if sample==1, p(rail1860) reps (100) alg(attnd) se(bse)

	




***************************************************
* Table 1.3.1 Dosage wtih Black Elected Officials 
***************************************************
set seed 1234
xtreg  black_office numb_camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths battle_count,  i(stateid) fe vce(boot)
outreg2 using table_131.tex,  label replace

set seed 1234
xtreg black_office numb_camps  neighbor landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths battle_count, i(stateid) fe vce(boot)
outreg2 using table_131.tex,  label





**************************************
* Table 1.4.1 Altering functional form
**************************************
* Different functional forms (these can take a long time to run) 
set seed 1234
* Poisson or Negative Binomial 
nbreg  black_office camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths battle_count  i.stateid, vce(boot)
outreg2 using table_141.tex,  label replace
poisson  black_office camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths battle_count  i.stateid, vce(boot)
outreg2 using table_141.tex,  label
* binary 
set seed 1234
xtlogit  black_office_bin camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths battle_count if ~missing(black_office),  i(stateid) fe vce(boot)
outreg2 using table_141.tex,  label




******************************************************
* Table 1.5.1 Summary of Alternative Outcome Measures 
******************************************************
* Dependent Variables 
eststo campsda: estpost summarize ///
      black_office black_del per_black_reg  if camps == 1 & sample==1
eststo nocampsda:  estpost summarize ///
   black_office black_del per_black_reg    if camps == 0 & sample==1
eststo diffda:  estpost ttest ///
    black_office  black_del per_black_reg   if sample==1 , by(camps) unequal

esttab campsda  nocampsda diffda using table_151.tex, ///
cells("mean(pattern(1 1 0) fmt(2)) sd(pattern(1 1 0)) b(star pattern(0 0 1) fmt(2)) t(pattern(0 0 1) par fmt(2))") ///
label tex replace







******************************************************
* Table 1.5.2 Alternative Outcome Measures 
******************************************************
set seed 1234
eststo m1: bootstrap r(att) : psmatch2 camps   landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths  battle_count i.stateid, out(black_office) mahalanobis(  battle_count landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit conf_deaths union_deaths  rail1860 water1860  i.stateid)
outreg2 using table_152.tex,  label replace tex
coefplot  m1 , scheme(s1mono) coeflabels(_bs_1="Camps") vertical  ytitle("Black Elected Official") yline(0)  mlabel format(%9.2f) levels(95 90 )
graph save graph_m1.gph, replace


set seed 1234
xtreg  black_office   camps   landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths battle_count,  i(stateid) fe vce(boot)
outreg2 using table_152.tex,  label tex

set seed 1234
* note- we only have delegate information for former confederate states; sample adjusted accordingly 
eststo m2: bootstrap r(att) : psmatch2 camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860  conf_deaths union_deaths  battle_count if sample_confed==1 , out(black_del) mahalanobis(  battle_count landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths rail1860 water1860  i.stateid)
outreg2 using table_152.tex,  label tex
coefplot  m2 , scheme(s1mono) coeflabels(_bs_1="Camps") vertical  ytitle("Black Delegate") yline(0)  mlabel format(%9.2f) levels(95 90)
graph save graph_m2.gph, replace


set seed 1234
xtreg  black_del camps     landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860  conf_deaths union_deaths  battle_count if sample_confed==1 ,  i(stateid) fe vce(boot)
outreg2 using table_152.tex,  label tex

set seed 1234
eststo m3: bootstrap r(att) : psmatch2 camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860  conf_deaths union_deaths  battle_count i.stateid, out(per_black_reg) mahalanobis( battle_count  landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit conf_deaths union_deaths  rail1860 water1860  i.stateid)
outreg2 using table_152.tex,  label tex
coefplot  m3 , scheme(s1mono) coeflabels(_bs_1="Camps") vertical  ytitle("% Black Voter Registration") yline(0)  mlabel format(%9.2f) levels(95 90)
graph save graph_m3.gph, replace 


set seed 1234
xtreg per_black_reg camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths battle_count,  i(stateid) fe vce(boot)
outreg2 using table_152.tex,  label tex


******************************************************
* Figure 1.5.1 Alternative Outcome Measures 
******************************************************
graph combine graph_m1.gph graph_m2.gph graph_m3.gph, rows(1) ycommon xcommon  scheme(s1mono)
								graph save graph_officials.gph, replace
				graph export figure_151.pdf, as(pdf) replace
				


***************************************************************
* Figure 1.6.1 Black Population Size and Elected Officials  
***************************************************************

* Majority Black counties 
twoway (scatter black_office blkprop1860, by(camps) xline(.5)) (lfit black_office blkprop1860, by(camps)), scheme(s1mono) legend(off) xtitle("Percent Black Population, 1860")
graph export graph_majblack.pdf, as(pdf) replace




***************************************************************
* Table 1.6.1 Majority Black Counties 
***************************************************************
set seed 1234
bootstrap r(att) : psmatch2 camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths rail1860 water1860 battle_count  maj_black i.stateid, out(black_office) mahalanobis( battle_count landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths  rail1860 water1860 maj_black  i.stateid) 
outreg2 using table_161.tex, replace label tex


set seed 1234
xtreg  black_office   camps  maj_black landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths battle_count,  i(stateid) fe vce(boot)
outreg2 using table_161.tex,  label tex
set seed 1234






***************************************************************
* Figure 1.6.2 Change in Population Size from 1860 to 1870
***************************************************************


twoway (scatter black_office blkprop1870, by(camps)) (lfit black_office blkprop1870, by(camps))
twoway (pcarrow black_office blkprop1860 black_office blkprop1870 if camps==1) || (pcarrow black_office blkprop1860 black_office blkprop1870 if camps==0), scheme(s1mono) legend(order(1 "Camps" 2 "No Camps"))
twoway (pcarrow black_office blkprop1860 black_office blkprop1870 if camps==1,  lcolor(black) mcolor(black) mfcolor(black) mlcolor(black)) || (pcarrow black_office blkprop1860 black_office blkprop1870 if camps==0) || (scatter black_office blkprop1860  if missing(blkprop1870) & sample==1 & camp==1) ///
		 || (scatter black_office blkprop1860  if missing(blkprop1870) & sample==1 & camp==0) , scheme(s1mono) legend(order(1 "Camps" 2 "No Camps" 3 "Missing 1870, Camp" 4 "Missing 1870, No Camp")) xtitle("Percent Black population")
graph export figure_162.pdf, as(pdf) replace



***********************************************************************
* Figure 1.6.3 Histogramof Change in Population Size from 186- to 1870 
***********************************************************************


histogram change_6070 if sample==1, by(camps) scheme(s1mono) xtitle("Change in Black Population between 1860 and 1870")
graph export figure_163.pdf, as(pdf) replace

***************************************************************
* Table 1.6.2 Removing moar populous counties  
***************************************************************

* get the 95th percentile for population for sample of counties 
*set seed 1234
*bootstrap r(att) : psmatch2 camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths rail1860 water1860 battle_count  ///
*   i.stateid, out(black_office) mahalanobis( landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths rail1860 water1860 battle_count  i.stateid) 
*gen sampop=e(sample)
*centile totpop1860_up if sampop==1, centile(5(5)95)

set seed 1234
bootstrap r(att) : psmatch2 camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths rail1860 water1860 battle_count  ///
   i.stateid  if  totpop1860_up<22727.05, out(black_office) mahalanobis( landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths rail1860 water1860 battle_count  i.stateid) 
outreg2 using table_162.tex,  replace label tex


set seed 1234
xtreg  black_office   camps  landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths rail1860 water1860 battle_count if  totpop1860_up<22727.05,  i(stateid) fe vce(boot)
outreg2 using table_162.tex,  label tex


***************************************************************
* Table 1.6.3 Accounting for Migration  
***************************************************************

* excludes 4 camps that become majority black
set seed 1234
bootstrap r(att) : psmatch2 camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths rail1860 water1860 battle_count  ///
  maj_black i.stateid if  exclude==0, out(black_office) mahalanobis( battle_count landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths  rail1860 water1860 maj_black   i.stateid) 
outreg2 using table_163.tex,  replace label tex
  
xtreg  black_office   camps  landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths battle_count  if  exclude==0  ,  i(stateid) fe vce(boot)
outreg2 using table_163.tex,  label tex
  
  
  * excludes 15 neighboring counties that became minority and 4 camps that became majority
  set seed 1234
bootstrap r(att) : psmatch2 camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths rail1860 water1860 battle_count  ///
  maj_black i.stateid if  exclude==0 & exclude_neighbor==0, out(black_office) mahalanobis( battle_count landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths  rail1860 water1860 maj_black   i.stateid) 
outreg2 using table_163.tex,  label tex

xtreg  black_office   camps  landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths battle_count  if  exclude==0 & exclude_neighbor==0 ,  i(stateid) fe vce(boot)
outreg2 using table_163.tex,  label tex






************************************************************************
* Table 1.6.4 Excluding Counties with the Most Black Elected Officials   
************************************************************************

* exclude any county that had more than 30 Black elected officials (drops 2)
set seed 1234
bootstrap r(att) : psmatch2 camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths rail1860 water1860 battle_count i.stateid if black_office<40, out(black_office) ///
mahalanobis( battle_count landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths  rail1860 water1860  i.stateid) 
outreg2 using table_164.tex,  label tex replace
xtreg  black_office   camps  landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths battle_count  if black_office<40,  i(stateid) fe vce(boot)
outreg2 using table_164.tex,  label tex


* exclude any county that had more than 20 Black elected officials (drops 4)
set seed 1234
bootstrap r(att) : psmatch2 camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths rail1860 water1860 battle_count i.stateid if black_office<20, out(black_office) ///
mahalanobis( battle_count landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths  rail1860 water1860  i.stateid) 
outreg2 using table_164.tex,  label tex

xtreg  black_office   camps  landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths battle_count if black_office<20,  i(stateid) fe vce(boot)
outreg2 using table_164.tex,  label tex



************************************************************************
* Table 1.7.1 Antebellum Religious Institutions    
************************************************************************

* church
set seed 1234
bootstrap r(att) : psmatch2 camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  ///
  conf_deaths union_deaths rail1860 water1860 battle_count church_new i.stateid, out(black_office) mahalanobis( battle_count landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths  rail1860 water1860 church_new  i.stateid) 
outreg2 using table_171.tex,  label tex replace 

set seed 1234
xtreg  black_office   camps  church_new landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths battle_count ,  i(stateid) fe vce(boot)
outreg2 using table_171.tex,  label tex

* dummy version  
 set seed 1234
bootstrap r(att) : psmatch2 camps    landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  ///
  conf_deaths union_deaths rail1860 water1860 battle_count church_new_dum i.stateid, out(black_office) ///
  mahalanobis( battle_count landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit  conf_deaths union_deaths  rail1860 water1860 church_new_dum  i.stateid) 
 outreg2 using table_171.tex,  label tex

 set seed 1234
 xtreg  black_office   camps church_new_dum  landineq1860_up  totpop1860_up fvalpc1860_up fbprop1860_up pslave1860_up cottonsuit   rail1860 water1860 conf_deaths union_deaths battle_count ,  i(stateid) fe vce(boot)
outreg2 using table_171.tex,  label tex

 
 
 
 
 
 
